using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Wzh_CheckAB
{
    public class HairData_Dic : IDataDic
    {
        public List<ItemDataBase> Datalist => datalist;
        private List<ItemDataBase> datalist = new List<ItemDataBase>();
        private Dictionary<int, HairData> dataDic;
        private string name;
        public HairData_Dic(string name, Dictionary<int, HairData> dataDic)
        {
            this.name = name;
            this.dataDic = dataDic;
            datalist.AddRange(dataDic.Values);
        }
        public int Count()
        {
            return dataDic.Count;
        }

        public string TName()
        {
            return name;
        }
        public object GetData(int index)
        {
            return datalist[index];
        }

        public int GetDateID(int index)
        {
            return datalist[index].id;
        }

        public string GetDateName(int index)
        {
            return datalist[index].name;
        }

        public GameObject Show3D(ItemDataBase data)
        {
            var pbdata = data as PrefabData;
            if (pbdata == null) return null;
            return AssetBundleLoader.LoadAndInstantiate<GameObject>(pbdata.assetbundleDir, pbdata.assetbundleName, pbdata.prefab);
        }
    }
}